#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main() {

    int x;
    cin >> x;

    int y = 1, num = 1;

    while(y < x) {
        y = y * 10 + 1;
        num++;
    }

    while(1) {
        cout << y / x;
        y = y % x;

        if(!y)
            break;

        y = y * 10 + 1;
        num++;
    }
    cout << " " << num;

    return 0;
}

